$(document).ready(function(){
    
    // Socials
    var socialSpace = $(".socials");
    $(".socials > div > a").hover(function(){
        var currentPos = $(this).siblings(".the-line").height();
        var that = $(this).siblings(".the-line");

        that.animate(
            {height: currentPos-5},
            {
                complete: function(){
                    that.animate({height: currentPos});
                }
            }
        );
    },function(){
        var currentPos = $(this).children(".the-line").height();
        $(this).children(".the-line").animate({height: currentPos});
    });
    
    // Mail Me
    var myEmail = $(".mail-me").text();
    myEmail = myEmail.replace("[at]","@");
    $(".mail-me").empty().append($("<a/>").attr("href","mailto:"+myEmail).text(myEmail));
    
    // Call Me
    var myNum = $(".call-me").text();
    $(".call-me").hover(function(){
        $(this).text("E-mail me for this please.");
    },function(){
        $(this).text(myNum);
    });
    
    // Message box
    $(".message").hover(function(){
        $(this).addClass("first-blue");
        $(this).children(".shadow-box-maker").addClass("shadow-green");
    },function(){
        $(this).removeClass("first-blue");
        $(this).children(".shadow-box-maker").removeClass("shadow-green");
    });
    
    // Top Menu
/*    $(".top-bar-section ul li a").on('click', function(e){
        var functionName = "load" + $(this).attr("href").substring(1);
        
        if(typeof window[functionName] == 'function'){
            e.preventDefault();
            window[functionName]();
        }else{
            // FIX ME
            e.preventDefault();
            console.log("Function not found");
        }
        
        return true;
    });*/
});

function loadskillset(){
    if(!$(".right-rail").hasClass("hide")){
        $(".right-rail").hide({duration: 'slow', complete: function(){
            $(".right-rail").addClass("hide hide-for-large");
        }});
    }
    console.log("Inside loadskillset");
}

function loadcontact(){
    if($(".right-rail").hasClass("hide")){
        $(".right-rail").removeClass("hide hide-for-large");
        $(".right-rail").show({duration: 'slow', complete: function(){            
        }});
    }    
}